package com.freesky.biz.rights.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.freesky.biz.rights.domain.RightsPayIcbcEntity;
import com.freesky.biz.rights.mapper.RightsPayIcbcMapper;
import com.freesky.biz.rights.service.IRightsPayIcbcService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RightsPayIcbcServiceImpl extends ServiceImpl<RightsPayIcbcMapper, RightsPayIcbcEntity> implements IRightsPayIcbcService {

    @Autowired
    private RightsPayIcbcMapper rightsPayIcbcMapper;

    @Override
    public List<RightsPayIcbcEntity> selectUnProcessed(List<String> busiIdList,
                                                       String startDt) {
        LambdaQueryWrapper<RightsPayIcbcEntity> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(RightsPayIcbcEntity::getBusiId,busiIdList);
        queryWrapper.eq(RightsPayIcbcEntity::getPayStatus,"0");
        queryWrapper.eq(RightsPayIcbcEntity::getProcessed,0);
        queryWrapper.le(RightsPayIcbcEntity::getCreateTime,startDt);
        queryWrapper.orderByAsc(RightsPayIcbcEntity::getCreateTime).last("limit 500");
        return rightsPayIcbcMapper.selectList(queryWrapper);
    }

}